#include<iostream>
using namespace std;

int main(){
	int a = 0;
	int b = 0;
	int c = 0;
	int d = 0;
	cin >> a >> b >> c >> d;
	int min1 = a * 60 + b;
	int min2 = c * 60 + d;
	int ret = min2 - min1;
	int e = ret / 60;
	int f = ret % 60;
	cout << e << " " << f;
	return 0;
}
